package edu.kjxy.day03.synchronizedBlockLockAll.test3;

/**
 * 功能:当其他线程执行x对象中synchronized(this)代码块时也呈同步效果
 * 作者:程序员欧阳子韩
 * 日期:2024/2/2 19:54
 */
public class RunTest1 {
    public static void main(String[] args) throws InterruptedException {
        Service service = new Service();
        MyObject object = new MyObject();
        ThreadA a = new ThreadA(service, object);
        a.setName("a");
        a.start();
        Thread.sleep(100);
        ThreadB b = new ThreadB(service, object);
        b.setName("b");
        b.start();
    }
}
